package com.sangachy.stg;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
public class Game implements ApplicationListener {

	private Stage stage;
//	private Texture background;
	private Image bg;
//	private Label fps;
//	private WordsManager words;
//	private LineBullets bullets;
//	private BitmapFont font;
//	private OrthographicCamera camera;
//	private SpriteBatch spriteBatch;

	
	public void create() {

		stage = new Stage(800, 480, true);//, spriteBatch); //可拉伸\
		
//
//		System.out.println(spriteBatch.getProjectionMatrix());
//		font = new BitmapFont(Gdx.files.getFileHandle("data/font.fnt", FileType.Internal), Gdx.files.getFileHandle(
//				"data/font.png", FileType.Internal), false);
		PictureManager.load();

		bg = new Image(PictureManager.background);
		bg.x = 0;	//图片中心位置
		bg.y = 480;
		stage.addActor(bg);

//		fps = new Label("FPS:", font);
//		fps.x = 300;
//		fps.y = 300;
//		words = new WordsManager();
//		ScaleTo.$(0.5f, 0.5f, 1f);
//		bg.action(Forever.$(RotateBy.$(21f, 2f)));
//		stage.addActor(fps);
//		stage.addActor(words);
		
//		renderer = new ShapeRenderer();
//		bullets = new LineBullets(new Position(400,240));
	}

//	public void draw (SpriteBatch batch, float parentAlpha) {
//	        batch.begin();
//
//	        renderer = new ShapeRenderer();
//	        renderer.setProjectionMatrix(batch.getProjectionMatrix());
//	        renderer.setTransformMatrix(batch.getTransformMatrix());
//	        renderer.translate(1, 2, 0);
//
//	        renderer.begin(ShapeType.Rectangle);
//	        renderer.rect(0, 0, 400, 140);
//	        renderer.end();
//
////	        bullets.update(Gdx.graphics.getDeltaTime());
////	        bullets.render(batch);
//	        
//	        batch.end();
//	       // batch.begin();
//	}
	
	public void render() {
//		fps.setText("FPS:"+Gdx.graphics.getFramesPerSecond()+':'+stage.isStretched());
//		stage.act(Gdx.graphics.getDeltaTime());
		stage.draw();
//		draw(stage.getSpriteBatch(),1f);
	}

	public void resize(int width, int height) {
//		stage.setViewport(width, height, true);
	}

	public void pause() {
	}

	public void resume() {
	}

	public void dispose() {
		stage.dispose();
	}
}